(function() {

  if (typeof DRINKLOCATOR === "undefined" || DRINKLOCATOR === null) {
    DRINKLOCATOR = {};
  }

  if (DRINKLOCATOR.map == null) DRINKLOCATOR.map = {};

  if (DRINKLOCATOR.markLocation == null) {
    DRINKLOCATOR.markLocation = function(storeWithInventory) {
      var pin;
      pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(storeWithInventory.Store.Latitude, storeWithInventory.Store.Longitude));
      return DRINKLOCATOR.map.entities.push(pin);
    };
  }

  if (DRINKLOCATOR.getMap == null) {
    DRINKLOCATOR.getMap = function(mapCredentials, results, divContainingMap) {
      var mapOptions, result, _i, _len;
      mapOptions = {
        credentials: mapCredentials,
        height: 480,
        width: 400,
        mapTypeId: Microsoft.Maps.MapTypeId.road,
        zoom: 12
      };
      DRINKLOCATOR.map = new Microsoft.Maps.Map(document.getElementById(divContainingMap), mapOptions);
      for (_i = 0, _len = results.length; _i < _len; _i++) {
        result = results[_i];
        DRINKLOCATOR.markLocation(result);
      }
      return DRINKLOCATOR.map.setView({
        center: new Microsoft.Maps.Location(results[0].Store.Latitude, results[0].Store.Longitude)
      });
    };
  }

  if (DRINKLOCATOR.inventorySetup == null) {
    DRINKLOCATOR.inventorySetup = function() {
      return $(".storeAddress").click(function() {
        var latitude, longitude;
        latitude = $(this).data("latitude");
        longitude = $(this).data("longitude");
        return alert("lat: " + latitude + " long: " + longitude);
      });
    };
  }

  if (DRINKLOCATOR.storeSearchSetup == null) {
    DRINKLOCATOR.storeSearchSetup = function(cityTextBoxId, cities) {
      $("#accordion").accordion({
        collapsible: false,
        autoHeight: false
      });
      return $("#TextBoxCity").autocomplete({
        minLength: 3,
        source: cities
      });
    };
  }

  if (DRINKLOCATOR.pageSetupCommon == null) {
    DRINKLOCATOR.pageSetupCommon = function() {
      $(":button").button();
      return $(":submit").button();
    };
  }

  if (DRINKLOCATOR.addPersonalLocationSetup == null) {
    DRINKLOCATOR.addPersonalLocationSetup = function() {
      return $("#accordion").accordion({
        collapsible: false,
        autoHeight: false
      });
    };
  }

}).call(this);
